﻿/**
*立案审理
*/
Chenxin.UI.CognizanceLitigationForm = Chenxin.extend(Chenxin.UI.FormCommon, {
    actionUrl: '/service/logic/ShowListLitigation.ashx',
    id: 'ConLit',
    renderTo: 'divCognizance',
    title: '立案审理',
    jqmWidth: 600,
    defBBtn:true,
    createForm: function() {
        return Chenxin.FormCommon.CognizanceLitigationForm(this.id);
    },
    initEvent: function() {
        var _this = this;
        $("#TrialDate").focus(function(){
            WdatePicker({dateFmt:'yyyy-MM-dd',oncleared:function(){$(this).blur();},onpicked:function(){$(this).blur();}})
        });
        
        this.findByName('CurrentTrialStatus').bind('click',function(){
             if(this.value == 10)
             {
                _this.findByName('TrialDate').val(_this.findByName('FirstTrialDate').val());
                _this.findByName('Court').val(_this.findByName('FirstTrialCourt').val());
                _this.findByName('Judge').val(_this.findByName('FirstTrialJudge').val());
                $('#TrialMemo').val(_this.findByName('FirstTrialMemo').val());
             }
             else if(this.value == 20)
             {
                _this.findByName('TrialDate').val(_this.findByName('SecTrialDate').val());
                _this.findByName('Court').val(_this.findByName('SecTrialCourt').val());
                _this.findByName('Judge').val(_this.findByName('SecTrialJudge').val());
                _this.findByName('TrialMemo').val(_this.findByName('SecTrialMemo').val());
             }
             else if(this.value == 30)
             {
                _this.findByName('TrialDate').val(_this.findByName('LastTrialDate').val());
                _this.findByName('Court').val(_this.findByName('LastTrialCourt').val());
                _this.findByName('Judge').val(_this.findByName('LastTrialJudge').val());
                _this.findByName('TrialMemo').val(_this.findByName('LastTrialMemo').val());
             }
        });
    },
    initFormValidator:function(){
        //立案时间
        $("#TrialDate").formValidator({
            validatorgroup: this.id,
            onshow: "请输入立案时间！",
            onfocus: "立案时间为必输项",
            oncorrect: " "
        }).inputValidator({ 
            min: 1,
            empty: {
                leftempty: false,
                rightempty: false,
                emptyerror: "立案时间不能为空！"
            },
            onerror: "立案时间不能为空！"
        });
        //法院
        $("#Court").formValidator({
            validatorgroup: this.id,
            onshow: "请输入法院！",
            onfocus: "法院为必输项",
            oncorrect: " "
        }).inputValidator({ 
            min: 1,
            empty: {
                leftempty: false,
                rightempty: false,
                emptyerror: "法院不能为空！"
            },
            onerror: "法院不能为空！"
        });
        //法官
        $("#Judge").formValidator({
            validatorgroup: this.id,
            onshow: "请输入法官！",
            onfocus: "法官为必输项",
            oncorrect: " "
        }).inputValidator({ 
            min: 1,
            empty: {
                leftempty: false,
                rightempty: false,
                emptyerror: "法官不能为空！"
            },
            onerror: "法官不能为空！"
        });
        //开庭进展
        $("#TrialMemo").formValidator({
            validatorgroup: this.id,
            onshow: "请输入开庭进展！",
            onfocus: "开庭进展为必输项",
            oncorrect: " "
        }).inputValidator({ 
            min: 1,
            empty: {
                leftempty: false,
                rightempty: false,
                emptyerror: "开庭进展不能为空！"
            },
            onerror: "开庭进展不能为空！"
        });
    },
    saveSucc: function() {
        this.reloadGrid();
    },
    initComponent: function() {
        Chenxin.UI.CognizanceLitigationForm.superclass.initComponent.call(this);
    }
});

Chenxin.FormCommon.CognizanceLitigationForm=function(formID){
	return '<table class="tbl_f"><tr><th style="width:105px; height:26px;">成交编号：</th><td><input name="ContractCode" class="inputbox_n fl" type="text" readonly="readonly" style="width:150px;"/></td></tr><tr><th>物业地址：</th><td colspan="3"><input name="HouseAddress" class="inputbox_n fl" type="text" style="width:430px;"readonly="readonly"/></td></tr><tr><th>诉讼进展：</th><td><input type="radio" value="10" name="CurrentTrialStatus" />一审<input type="radio" value="20" name="CurrentTrialStatus" />二审<input type="radio" value="30" name="CurrentTrialStatus" />再审</td></tr><tr><th>立案时间：</th><td><input id="TrialDate" name="TrialDate" class="inputbox_n fl" type="text" style="width:150px;" readonly="readonly"/></td></tr><tr><th>法院：</th><td><input id="Court" name="Court" class="inputbox_n fl" type="text" style="width:150px;"/></td></tr><tr><th>法官：</th><td><input id="Judge" name="Judge" class="inputbox_n fl" type="text" style="width:150px;"/></td></tr><tr><th>开庭进展：</th><td colspan="3"><textarea id="TrialMemo" name="TrialMemo" cols="80" rows="2" style="width: 435px; height: 65px;"class="textarea_n fl"></textarea></td></tr><tr><td colspan="2" ><input type="hidden"  name="FirstTrialDate" /><input type="hidden"  name="FirstTrialCourt" /><input type="hidden"  name="FirstTrialJudge" /><input type="hidden"  name="FirstTrialMemo" /><input type="hidden"  name="SecTrialDate" /><input type="hidden"  name="SecTrialCourt" /><input type="hidden"  name="SecTrialJudge" /><input type="hidden"  name="SecTrialMemo" /><input type="hidden"  name="LastTrialDate" /><input type="hidden"  name="LastTrialCourt" /><input type="hidden"  name="LastTrialJudge" /><input type="hidden"  name="LastTrialMemo" /></td></tr><tr><td colspan="2" ><input type="hidden"  name="RecordId" /></td></tr></table>';
};